package com.controller;

import com.model.DaoHang;
import com.model.MyUser;
import com.model.MyNode;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;

@Api("页面导航")
@RestController
public class MyDaoHangController {

    @CrossOrigin
    @ApiOperation(value = "根据用户主键获取操作模块的权限")
    @RequestMapping(value = "/getDaoHang", produces = "application/json;charset=utf-8", method = RequestMethod.PUT)
    public List<DaoHang> getDapHang(@RequestBody MyUser ip){
        System.out.println("进入导航方法");
        //   以下内容重点是模拟相关数据
        List<DaoHang> myDaoHangList=new ArrayList<>();
        /*1.给第一个大模块下的子模块赋值虚拟数据*/
        List<MyNode> myNodeList1=new ArrayList<>();

        /*2。给每一个子模块赋值*/
        MyNode myNode1=new MyNode();
        myNode1.setText("<span class='glyphicon glyphicon-user'>&nbsp;用户管理</span>");
        myNode1.setHref("userlist.html");
        myNodeList1.add(myNode1);

        MyNode myNode2=new MyNode();
        myNode2.setText("信息统计");
        myNode2.setHref("UserEcharts.html");
        myNodeList1.add(myNode2);

        /*3.给第一个模块赋值*/
        DaoHang myDao=new DaoHang();
        myDao.setText("系统管理");
        myDao.setNodes(myNodeList1);

        /*4.将所有大模块的属性放到集合中*/
        myDaoHangList.add(myDao);

        return myDaoHangList;
    }
}
